home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ubisoft Digital Press Ki….S.A./North America (USA)
/
Ubisoft Digital Press Kit 99 U.S.A.-North America (USA).bin
/
Dcr
/
language2.cst
/
00037_Script_Scroll Arrow Beh contact
< prev
next >
Wrap
Text File
|
1999-05-03
|
2KB
|
86 lines
-- Scroll Arrow Behavior
----------------------------------------------------------------
-- This behavior tells the Text behavior a user has clicked an
-- arrow button and that the Text behavior should therefore
-- scroll the text. You attach this behavior to an arrow
-- button.
--
-- 10/1/97 David Benman
----------------------------------------------------------------
-- pDirection - the type of button, up or down the
-- behavior is attached to
-- pScrollDelay-the number of ticks the behavior waits after
-- you click the arrow button and before the text starts
-- scrolling.
-- pClickedStatus - a boolean indicating if the
-- behavior's button has been clicked.
property pScrollDelayc, pClickedStatusc, pDirectionc
-- This handler determines if the button it is
-- attached to is an up or down button.
on beginSprite me
set pScrollDelayc to 10
-- Checks if the name of sprite you clicked is
-- an up or down button.
set currentMember to the member of sprite the spriteNum of me
if the name of member currentMember contains "up" then
set pDirectionc to #up
else
set pDirectionc to #down
end if
end
-- The mouseDown handler sends the scrollText message to all
-- the sprites in the current frame when you click an arrow
-- button. The text behavior contains a scrollText handler
-- designed to receive the message and scroll the text. The
-- mouseDown handler also starts the timer for use by the
-- following mouseWithin handler.
on mouseDown me
set pClickedStatusc to 1
sendAllSprites(#scrollTextc, pDirectionc)
startTimer
end
on mouseLeave me
set pClickedStatusc to 0
end
on mouseUp me
set pClickedStatusc to 0
end
-- The mouseWithin handler checks if the mouse button is still
-- pressed and that the timer is less than the preset scroll
-- delay time. This allows you to click and hold an arrow button
-- to continoously scroll. Also, the delay allows you to click
-- and release an arrow button within the delay time to scroll
-- the text a fixed amount, one line in this example.
--
-- So, this handler tells the text behavior to scroll if you
-- have clicked and held the arrow button for longer than the
-- scroll delay time.
on mouseWithin me
if pClickedStatusc = 1 then
if the mouseDown AND the timer > pScrollDelayc then
sendAllSprites(#scrollTextc, pDirectionc)
end if
end if
end